const MongoClient =require('mongodb').MongoClient

const client =new MongoClient('mongodb://localhost/demo')
async function run() {
    await client.connect()
    const col = client.db.collection('students')
    await col.insertMany([
        {name:'s1234',passwd:'123466',sex:'男',birth:'19990302',address:'zhejiang'},
        {name:'5667',passwd:'123466',sex:'女',birth:'19990602',address:'zhejiang'},
        {name:'5667',passwd:'123466',sex:'女',birth:'19990602',address:'zhejiang'},
        {name:'098',passwd:'123466',sex:'女',birth:'19990126',address:'zhejiang'},
        {name:'s465',passwd:'123466',sex:'男',birth:'19990502',address:'zhejiang'}
        
    ])
    const docs =  await col.find().toArray()
    console.log(docs)
    await client.close()
}
try {
    run()
} catch (error) {
    console.log(error)
}
